//package com.zj.sy.config.redis;
//
//import com.bjbz.common.cache.CacheManager;
//import com.bjbz.common.redis.base.IMessageDelegate;
//import com.bjbz.common.redis.base.RedisPublishSubscribeOpearetor;
//import com.bjbz.common.redis.base.RedisPublishSubscribeOpearetorEnum;
//import com.bjbz.common.util.JSONUtil;
//import com.bjbz.core.log.tools.LogHelper;
//import org.springframework.stereotype.Component;
//
//import java.io.Serializable;
//
//@Component
//public class DefaultMessageDelegate  implements IMessageDelegate{
//
//
//	@Override
//	public void handleMessage(Serializable message, String topic) {
////		System.err.println("----->Receive message from redis-topic:"+topic+";message:"+JSONUtil.toJSONString(message));
//		//处理同步本地缓存
//		RedisPublishSubscribeOpearetor redisPublishSubscribeOpearetor = JSONUtil.parseObject(message.toString(), RedisPublishSubscribeOpearetor.class);
//		if(redisPublishSubscribeOpearetor.getRedisPublishSubscribeOpearetorEnum()==RedisPublishSubscribeOpearetorEnum.DEL) {
//			CacheManager.delLocal(redisPublishSubscribeOpearetor.getCacheName(), redisPublishSubscribeOpearetor.getKey());
//			LogHelper.log(DefaultMessageDelegate.class, "同步删除本地缓存:"+redisPublishSubscribeOpearetor.getCacheName()+"-"+redisPublishSubscribeOpearetor.getKey());
//		}else if(redisPublishSubscribeOpearetor.getRedisPublishSubscribeOpearetorEnum()==RedisPublishSubscribeOpearetorEnum.ADD) {
////			CacheManager.putLocal(redisPublishSubscribeOpearetor.getCacheName(), redisPublishSubscribeOpearetor.getKey(),redisPublishSubscribeOpearetor.getObj());
//			if(!CacheManager.existLocal(redisPublishSubscribeOpearetor.getCacheName(), redisPublishSubscribeOpearetor.getKey())) {
//				CacheManager.putLocalFromRemote(redisPublishSubscribeOpearetor.getCacheName(), redisPublishSubscribeOpearetor.getKey());
//				LogHelper.log(DefaultMessageDelegate.class, "同步新增本地缓存:"+redisPublishSubscribeOpearetor.getCacheName()+"-"+redisPublishSubscribeOpearetor.getKey());
//			}
//		}
//	}
//
//
//}
